﻿using System;
using System.Drawing;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace Home.MobileSales.Common.Components
{
    public class BorderPanel:System.Windows.Forms.Panel
    {
        private Color _borderColor = Color.Black;
        private float _borderWidth = 1.00f;
        //private string _text = "Text";
        //private Font _textFont = new Font(FontFamily.GenericSerif, 10, FontStyle.Regular);

        public Color BorderColor { 
            get
            {
                return _borderColor;
            }
            set
            {
                _borderColor = value;
                Invalidate();
            } 
        }
        public float BorderWidth
        {
            get
            {
                return _borderWidth;
            }
            set
            {
                _borderWidth = value;
                Invalidate();
            }
        }

        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            Pen pen = new Pen(_borderColor, _borderWidth);
            e.Graphics.DrawRectangle(pen, new Rectangle((int)(_borderWidth/2),(int)(_borderWidth/2), (int)(Width - _borderWidth)  , (int)(Height - _borderWidth)));
            //e.Graphics.DrawString(_text, _textFont, new SolidBrush(Color.Black), 0, 0);
            base.OnPaint(e);
        }
    }
}
